package model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class VReview {
	private int reviewid;
	private int forumid;
	private String userid;
	private String realname;
	private String nickname;
	private int userphoto;
	private String photoname;
	private int ordernum;
	private String reviewcontent;
	private String ipaddr;
	private String createtime;
	
	public VReview(){
		
	}
	
	public VReview(ResultSet rs){
		try {
			if(rs!=null && rs.next()){
			this.reviewid = rs.getInt("reviewid");
			this.forumid = rs.getInt("forumid");
			this.userid = rs.getString("userid");
			this.realname = rs.getString("realname");
			this.nickname = rs.getString("nickname");
			this.userphoto = rs.getInt("userphoto");
			this.photoname = rs.getString("photoname");
			this.ordernum = rs.getInt("ordernum");
			this.reviewcontent = rs.getString("reviewcontent");
			this.ipaddr = rs.getString("ipaddr");
			this.createtime = rs.getString("createtime");
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	public static List<VReview> toList(ResultSet rs){
		List<VReview> list = new ArrayList<VReview>();
		if(rs!=null)
		{
			try {
				while (rs.next()) {
					VReview user = new VReview();
					user.reviewid = rs.getInt("reviewid");
					user.forumid = rs.getInt("forumid");
					user.userid = rs.getString("userid");
					user.realname = rs.getString("realname");
					user.nickname = rs.getString("nickname");
					user.userphoto = rs.getInt("userphoto");
					user.photoname = rs.getString("photoname");
					user.ordernum = rs.getInt("ordernum");
					user.reviewcontent = rs.getString("reviewcontent");
					user.ipaddr = rs.getString("ipaddr");
					user.createtime = rs.getString("createtime");
					list.add(user);
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return list;
		
	}

	
	public VReview(int reviewid, int forumid, String userid, String realname,
			String nickname, int userphoto, String photoname, int ordernum,
			String reviewcontent, String ipaddr, String createtime) {
		super();
		this.reviewid = reviewid;
		this.forumid = forumid;
		this.userid = userid;
		this.realname = realname;
		this.nickname = nickname;
		this.userphoto = userphoto;
		this.photoname = photoname;
		this.ordernum = ordernum;
		this.reviewcontent = reviewcontent;
		this.ipaddr = ipaddr;
		this.createtime = createtime;
	}

	public int getReviewid() {
		return reviewid;
	}

	public void setReviewid(int reviewid) {
		this.reviewid = reviewid;
	}

	public int getForumid() {
		return forumid;
	}

	public void setForumid(int forumid) {
		this.forumid = forumid;
	}

	public String getUserid() {
		return userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	public String getRealname() {
		return realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public int getUserphoto() {
		return userphoto;
	}

	public void setUserphoto(int userphoto) {
		this.userphoto = userphoto;
	}

	public String getPhotoname() {
		return photoname;
	}

	public void setPhotoname(String photoname) {
		this.photoname = photoname;
	}

	public int getOrdernum() {
		return ordernum;
	}

	public void setOrdernum(int ordernum) {
		this.ordernum = ordernum;
	}

	public String getReviewcontent() {
		return reviewcontent;
	}

	public void setReviewcontent(String reviewcontent) {
		this.reviewcontent = reviewcontent;
	}

	public String getIpaddr() {
		return ipaddr;
	}

	public void setIpaddr(String ipaddr) {
		this.ipaddr = ipaddr;
	}

	public String getCreatetime() {
		return createtime;
	}

	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}
	
	
	
}
